Skip to content

Conversation

@LucasKuhlemann
Copy link
Contributor

@LucasKuhlemann LucasKuhlemann commented Apr 15, 2024

Implement java.io.Serializable in kotlin data classes for kotlin-spring generator when serializableModel option is enabled.

Fixes #8317.

These existing samples clearly show the effect of this change, as they have serializableModel already set to true:

  • kotlin-springboot
  • kotlin-springboot-3
  • kotlin-springboot-modelMutable
  • kotlin-springboot-source-swagger1
  • kotlin-springboot-source-swagger2
  • kotlin-springboot-springfox

See the added Serializable interface on all generated models for those samples, as well as the serialVersionUID constant in each data class.

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh ./bin/configs/*.yaml
    ./bin/utils/export_docs_generators.sh
    
    (For Windows users, please run the script in Git BASH)
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • File the PR against the correct branch: master (upcoming 7.1.0 minor release - breaking changes with fallbacks), 8.0.x (breaking changes without fallbacks)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@LucasKuhlemann
Copy link
Contributor Author

cc
@jimschubert (2017/09) ❤️, @dr4ke616 (2018/08) @karismann (2019/03) @Zomzog (2019/04) @andrewemery (2019/10) @4brunu (2019/11) @yutaka0m (2020/03) @stefankoppier (2022/06)

@LucasKuhlemann LucasKuhlemann marked this pull request as draft April 15, 2024 10:56
@LucasKuhlemann LucasKuhlemann marked this pull request as ready for review April 18, 2024 22:13
@LucasKuhlemann
Copy link
Contributor Author

Could someone please review this?

@4brunu
Copy link
Contributor

4brunu commented Apr 23, 2024

Hi, can you please take a look at CI that is failing?

Perform git status
HEAD detached at pull/18386/merge
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Category.kt
	modified:   samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt
	modified:   samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Order.kt
	modified:   samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Pet.kt
	modified:   samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Tag.kt
	modified:   samples/client/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/User.kt

and another one

* What went wrong:
Execution failed for task ':bootJar'.
> Error while evaluating property 'mainClass' of task ':bootJar'
   > Failed to calculate the value of task ':bootJar' property 'mainClass'.
3 actionable tasks: 3 executed
      > Main class name has not been configured and it could not be resolved

@LucasKuhlemann
Copy link
Contributor Author

@4brunu Thanks for checking, and sorry for the late reaction.

I fixed the issue with uncommitted changes in the samples files, but I'm not sure about the second problem you pointed out. Where do you see this, or how could I try to reproduce this problem?

@4brunu
Copy link
Contributor

4brunu commented May 27, 2024

@LucasKuhlemann
Copy link
Contributor Author

@4brunu Seems the issue has been fixed by someone else on the master branch, the CI no longer fails.

@4brunu 4brunu merged commit 861e8f0 into OpenAPITools:master Jun 24, 2024
@wing328 wing328 added this to the 7.7.0 milestone Jun 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] kotlin-spring does not generate Serializable models

3 participants